<?php
$fileArray = array();


function listFolderFiles($dir, &$fileArray) {
    $ffs = scandir($dir);
    
    foreach ($ffs as $ff) 
    {
        
        if ($ff != '.' && $ff != '..') 
        {
            
            if(is_file($dir.'/'.$ff))
            {
                if(strpos($ff, '.css'))
                {
                    $fileArray[] = $dir.'/'.$ff;
                }
            }

            if (is_dir($dir . '/' . $ff))
                listFolderFiles($dir . '/' . $ff, $fileArray);
            
        }
    }
}

listFolderFiles(__DIR__.'/app/modules', $fileArray);

for($i = 0; $i < count($fileArray); $i++)
{
    $pos = strpos($fileArray[$i], '/app/modules');
    $fileArray[$i] = substr($fileArray[$i], $pos+1);
}
?>

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="app/library/ext-4/resources/css/ext-all.css">
        <link rel="stylesheet" type="text/css" href="app/css/desktop.css">
        <link rel="stylesheet" type="text/css" href="app/css/page.css">
        
        <?php
            for($i = 0; $i < count($fileArray); $i++)
            {
                echo '<link rel="stylesheet" type="text/css" href="'.$fileArray[$i].'">';
            }
        ?>

        <script type="text/javascript" src="app/library/ext-4/ext-all-debug.js"></script>

        <script type="text/javascript">
            Ext.Loader.setConfig({
                enabled: true,
                paths: {
                    'Ext.ux': 'app/library/ux/'
                }
            });


        </script>

        <script>

            function getInfo()
            {
                var xmlhttp;

                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp = new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange = function()
                {
                    if (xmlhttp.readyState === 4 && xmlhttp.status === 200)
                    {
                        obj = JSON.parse(xmlhttp.responseText);
                        console.log(obj);
                    }
                };

                xmlhttp.open("GET", "/src/public/settings/site/index", true);
                xmlhttp.setRequestHeader('Content-Type', 'application/json');
                xmlhttp.setRequestHeader("X_REQUESTED_WITH", "XMLHttpRequest");
                xmlhttp.send();
            }

        </script>

        <script type="text/javascript" src="app/Utils.js"></script>
        <script type="text/javascript" src="app/app.js"></script>

    </head>
    <body>

    </body>
</html>
